// 云函数代码
const cloud = require('wx-server-sdk')
cloud.init()

exports.main = async (event, context) => {
  const res = await cloud.cloudPay.unifiedOrder({
    body: event.body,
    outTradeNo: event.outTradeNo,
    spbillCreateIp: '127.0.0.1',
    subMchId: "1601822608",
    nonceStr:"yzwdjyzwdjyzwdjyzwdjyzwdjyzwdjyz",
    totalFee: event.totalFee,
    tradeType:"JSAPI", 
    envId: "yzwdj-yzwdj",
    functionName: "paycallback"
  })
  return res
}